﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1 {
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window {
		private ValidationObject validationObject;
		public MainWindow( ) {
			InitializeComponent( );
			this.validationObject = new ValidationObject( );
			this.DataContext = this.validationObject;
		}

		public void CheckValid( ) {
			//this.comboBox.GetBindingExpression(ComboBox.SelectedItemProperty).UpdateSource( );
			//this.text.GetBindingExpression(TextBox.TextProperty).UpdateSource( );
			this.TryUpdateSource( );
			this.IsValid( );
		}

		private void Button_Click(object sender, RoutedEventArgs e) {
			CheckValid( );
		}
	}

	internal class ValidationObject {
		public object Text { get; set; }
		public object Numeric { get; set; }
		public object Decimal { get; set; }
		public object Pesel { get; set; }
		public object Combo { get; set; }
		public object EditableCombo { get; set; }
		public object Date { get; set; }
		public object TextDate { get; set; }
		public object TextTime { get; set; }
		public object TextDateTime { get; set; }
		public object TextFormated { get; set; }
		public object Check { get; set; }
		public object Radio { get; set; }
	}
}
